import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type { AttactmentForm, AttactmentQuery, AttactmentVO } from "@/api/system/attact/types";

/**
 * 查询附件信息列表
 * @param query
 * @returns {*}
 */
export const listAttactment = (query?: AttactmentQuery): AxiosPromise<AttactmentVO[]> => {
  return request({
    url: "/file/attactment/list",
    method: "get",
    params: query
  });
};

/**
 * 新增附件信息
 * @param data
 */
export const addAttactment = (data: AttactmentForm) => {
  return request({
    url: "/file/attactment",
    method: "post",
    data: data
  });
};

/**
 * 删除附件信息
 * @param id
 */
export const delAttactment = (id: string | number | Array<string | number>) => {
  return request({
    url: "/file/attactment/" + id,
    method: "delete"
  });
};

/**
 * 修改客户端管理
 * @param data
 */
export const updateAttactment = (data: AttactmentForm) => {
  return request({
    url: "/file/attactment",
    method: "put",
    data: data
  });
};

/**
 * 查询客户端管理详细
 * @param id
 */
export const getAttactment = (id: string | number): AxiosPromise<AttactmentVO> => {
  return request({
    url: "/file/attactment/" + id,
    method: "get"
  });
};
